#ifndef YIGGRAPHICSVIEW_H
#define YIGGRAPHICSVIEW_H

// System includes
#include <QResizeEvent>
#include <QGraphicsView>
#include <QGraphicsRectItem>
#include <QPoint>

// Local includes
#include "graphics/yigsynthgraphic.h"

/**
*   YigGraphicsView defines a view for use with the Yig program
*/
class YigGraphicsView : public QGraphicsView
{
    Q_OBJECT

public:

    /**
    *   YigGraphicsView constructor
    *   @param    QWidget* Parent QWidget object
    */
    YigGraphicsView(QWidget* parent);

    /**
    *   YigGraphicsView deconstructor
    */
    ~YigGraphicsView();

public slots:

    /** handle resizing of the window */
    //void slotHandleResize(QResizeEvent *event);

protected:

    /** the current scale factor of the view */
    qreal scaleFactor;

    /** overridden graphicsview methods so we can add control via computer peripherals */
    void keyPressEvent( QKeyEvent *event );
    void mouseMoveEvent( QMouseEvent *event );
    void mouseReleaseEvent( QMouseEvent *event );
    void mousePressEvent( QMouseEvent *event );
    void resizeEvent( QResizeEvent *event );
    void wheelEvent(QWheelEvent *event);
    /** overridden for efficiency?? */
    void paintEvent(QPaintEvent *event);

    /** used to anchor the selectionRect */
    QPoint mouseDownPos;
    /** used to size the selectionRect */
    QPoint lastMouseViewPos;

    /** the selectionRect shape is used to check for items in the graphics view and select
    *  those that fall within the bounds of the selectionRect.
    */
    QGraphicsRectItem* selectionRect;

};

#endif // YIGGRAPHICSVIEW_H
